package com.sleep.ruledemo.service.imol;

import cn.hutool.core.map.MapBuilder;
import cn.hutool.core.map.MapUtil;
import com.sleep.ruledemo.service.ThreadLocalTestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author GuoAo
 * @className ThreadTestServiceAImpl
 * @date 2025/7/29
 * @description TODO
 */
@Service("testA")
@Slf4j
public class ThreadTestServiceAImpl implements ThreadLocalTestService {

    private ThreadLocal<Map<String,Object>> threadLocal = new ThreadLocal<>();

    @Override
    public void test() {
        Map<String, Object> build = new MapBuilder<>(new HashMap<String, Object>()).put("name", "testA").build();
        log.info("放入线程变量：{}  线程名称：{}", build,Thread.currentThread().getName());
        threadLocal.set(build);
    }
}
